package co.com.smart.eagle.bean.resources;

import java.util.ArrayList;
import java.util.List;

import javax.ejb.Stateless;

import co.com.smart.eagle.entities.EagleSecurityResources;
import co.com.smart.eagle.infrastructure.dto.RecursosDTO;
import co.com.smart.eagle.mapper.Mapper;
import co.com.smart.eagle.persistence.entity.ResourcesFacadeLocal;
import co.com.smart.eagle.session.DelegateContextEJB;

/**
 * Session Bean implementation class ResourcesBean
 */
@Stateless(mappedName = "ejb/ResourcesBean")
public class ResourcesBean implements ResourcesBeanLocal {

	private ResourcesFacadeLocal facade;
    /**
     * Default constructor. 
     */
    public ResourcesBean() {
    	facade = DelegateContextEJB.getResourcesFacadeLocal();
    }
    
	@Override
	public List<RecursosDTO> getResources() {
		List<RecursosDTO> resources = new ArrayList<RecursosDTO>();
		List<EagleSecurityResources> resourcesEntity = facade.findAll();
		if (resourcesEntity != null) {
			for (EagleSecurityResources eagleSecurityResources : resourcesEntity) {
				resources.add(Mapper.mapperResources(eagleSecurityResources)) ;
			}
		}
		return resources;
	}
	@Override
	public void setResource(RecursosDTO resources) throws Exception {
		
	}
	@Override
	public void editResource(RecursosDTO resources) throws Exception {
		
	}
	@Override
	public void deleteResource(RecursosDTO resources) throws Exception {
		
	}

}
